#ifndef ANOTC_PROTOCOL_H
#define ANOTC_PROTOCOL_H

#include "ct_uart.h"

#define MOUDLE_ANOTCFRAME_ENABLE

/******************************************************************/
#ifdef MOUDLE_ANOTCFRAME_ENABLE
// Assuming the protocol header occupies 4 bytes
#define ANOTC_PROTOCOL_HEADER_SIZE 4u
// Assuming the checksum occupies 2 bytes
#define ANOTC_CHECKSUM_SIZE 2u

#define ANOTC_FRAME_LENGTH_MAX 40u
#define ANOTC_TIMEOUT_CNT      100    // Define the timeout count value
// Anotc protocol header
#define ANOTC_FRAME_HEADER   0xAA
#define ANOTC_FRAME_ADDRESS  0xFF
#define ANOTC_FRAME_FLEXIBLE 0xF1

//

#define ANOTC_FRAME_UPPER_READ  0xE1
#define ANOTC_FRAME_UPPER_WRITE 0XE2

/**
 * @brief Write an Anotc frame to UART.
 *
 * @param UARTx Pointer to a UART_t structure that contains the configuration information for the UART.
 */
void Anotc_WriteFrame(UART_t *UARTx);

/**
 * @brief Read Anotc protocol via UART
 *
 * @param UARTx Pointer to UART structure
 * @return void
 *
 * @note This function reads the protocol header, data, and checksum.
 * If the checksum is incorrect, the function returns.
 */
void Anotc_ReadFrame(UART_t *UARTx);

#endif    // DEBGUG_ANOTCFRAME_UART
/******************************************************************/

#endif    // _DEBUG_UART_H
